

<!DOCTYPE HTML>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Demo: Custom Widget</title>
	<link rel="stylesheet" href="../libs/demo/style.css" media="screen">
	<link rel="stylesheet" href="../libs/demo/demo.css" media="screen">
</head>
<body>
<h1>Demo: Custom Widget</h1>
<div id="authorContainer"></div>

<!-- load dojo -->
<script src="../libs/dojo/dojo.js" data-dojo-config="isDebug: 1, async: 1, parseOnLoad: 1"></script>
	 <script>
        var dojoConfig = {
            async: true,
            baseUrl:'../',
			packages: [  
        	{ name: "dojo", location: "libs/dojo" },  
        	{ name: "dijit", location: "libs/dijit" },  
        	{ name: "dojox", location: "libs/dojox" },
			{ name: "myApp", location: "libs/myApp" }
			] 
        };
    </script>
<script>
	// Bring in our custom widget
	require(["dojo/request", "dojo/dom", "dojo/_base/array", "myApp/widget/AuthorWidget", "dojo/domReady!"],
		function(request, dom, arrayUtil, AuthorWidget){
		var authorContainer = dom.byId("authorContainer");
		var author = {
        "name": "zhl",
        "avatar":  require.toUrl("myApp/widget/images/defaultAvatar.jpg"),//require.toUrl 方法能获取myapp所在空间的路径
        "bio": "Brian Arnold is a software engineer at SitePen, Inc., ..."
    };
		var widget = new AuthorWidget().placeAt(authorContainer);
		var widget1 = new AuthorWidget(author).placeAt(authorContainer);
		});
</script>
</body>
</html>